﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;
using Newtonsoft.Json.Serialization;
using DateModel.Typedef;

namespace DateModel.Send
{
    public class AllBase<T> where T : IDataBase,new()
    {
        string stage;//站点名称（STRING）
        string message;//返回信息（STRING）
        ErrorType code;//错误代码（INT）
        T data;//数据空间

        [Newtonsoft.Json.JsonProperty(PropertyName = "stage")]
        public string Stage
        {
            get
            {
                return stage;
            }

            set
            {
                stage = value;
            }
        }

        [Newtonsoft.Json.JsonProperty(PropertyName = "message")]
        public string Message
        {
            get
            {
                return message;
            }

            set
            {
                message = value;
            }
        }

        [Newtonsoft.Json.JsonProperty(PropertyName = "code")]
        public ErrorType Code
        {
            get
            {
                return code;
            }

            set
            {
                code = value;
            }
        }

        [Newtonsoft.Json.JsonProperty(PropertyName = "data")]
        public T Data
        {
            get
            {
                if (data == null)
                    data = new T();
                return data;
            }

            set
            {
                data = value;
            }
        }
    }
}